window: unset menubar before unsetting focus on dispose()
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 14 Oct 2014 13:30:34 +0000 (15:30 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 14 Oct 2014 13:47:06 +0000 (15:47 +0200)
If the menubar has an app-menu popover, and it is shown at the time of
disposing the window, it will attempt to transfer focus back to the
previous focus widget when undoing modality, even though the dispose()
code already did set_focus(NULL) previously.

At the time the popover is removed, there aren't many hints as to whether
the toplevel or the focus widget are being destroyed (ie. not still under
in_destruction), so just swap the order of these two calls.

For every other popover, this would all happen within dispose/destroy,
which is handled better.

gtk/gtkwindow.c

index 424779c7ae7f867bfd4aab1a853510c8913c8eae..bf6d85c63090b17decd5b4328eb32eea404a45a8 100644 (file)
@@ -2938,9 +2938,9 @@ gtk_window_dispose (GObject *object)
   GtkWindow *window = GTK_WINDOW (object);
   GtkWindowPrivate *priv = window->priv;
 
+  unset_titlebar (window);
   gtk_window_set_focus (window, NULL);
   gtk_window_set_default (window, NULL);
-  unset_titlebar (window);
   remove_attach_widget (window);
 
   G_OBJECT_CLASS (gtk_window_parent_class)->dispose (object);